*STATA Do File for analyses in “Exposure to Neighbor Adoptions, Agenda Setting Behavior, and Policy Diffusion”
*Todd Makse
*April 2024

*Map 1 
use "C:\ENAPD Exposure Counties.dta"
spmap exposure using "County2.dta" if cont==1, id(_ID)
gr_edit .legend.plotregion1.key[1].view.style.editstyle area(shadestyle(color(gs12))) editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle area(shadestyle(color(black))) editcopy
gr_edit .legend.plotregion1.key[3].view.style.editstyle area(shadestyle(color(white))) editcopy
gr_edit .plotregion1.plot2.style.editstyle area(linestyle(color(gs12))) editcopy
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle boxstyle(linestyle(color(black))) editcopy
gr_edit .legend.plotregion1.key[1].xsz.editstyle 5 editcopy
gr_edit .legend.plotregion1.key[1].ysz.editstyle 4 editcopy
gr_edit .legend.plotregion1.key[2].xsz.editstyle 5 editcopy
gr_edit .legend.plotregion1.key[2].ysz.editstyle 4 editcopy
gr_edit .legend.plotregion1.key[3].xsz.editstyle 5 editcopy
gr_edit .legend.plotregion1.key[3].ysz.editstyle 4 editcopy
gr_edit .legend.plotregion1.label[1].text = {}
gr_edit .legend.plotregion1.label[1].text.Arrpush In-State Media Market Counties
gr_edit .legend.plotregion1.label[1].style.editstyle size(2.5) editcopy
gr_edit .legend.plotregion1.label[2].text = {}
gr_edit .legend.plotregion1.label[2].text.Arrpush Out-of-State Media Market Counties
gr_edit .legend.plotregion1.label[2].style.editstyle size(2.5) editcopy
gr_edit .legend.plotregion1.label[3].text = {}
gr_edit .legend.plotregion1.label[3].text.Arrpush Not in Study
gr_edit .legend.plotregion1.label[3].style.editstyle size(2.5) editcopy

*Bivariate analyses
use C:\ENAPD Replication Dataset.dta"
ttest polauth if multauth==1, by(oos_adopt_d)
ttest polspon , by(oos_adopt_d)
*Distinguishing between non-exposure districts and exposure districts where policy wasn’t adopted
tabstat polauth if multauth==1, by(oos_adopt)
tabstat polspon , by(oos_adopt)
ttest polauth if multauth==1 & oos_adopt!=99, by(oos_adopt)
ttest polspon if oos_adopt!=99, by(oos_adopt)

*Main models (main text and Table A-4)
*Authorship models
quietly melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 
est store a1
quietly melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 || _all: R.polnum
matrix a1 = e(b)
est store a2
melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol  if multauth==1 || _all: R.polnum|| statenum:, from(a1) difficult
est store a3
margins, at(oos_adopt_d=(0 1)) 
margins, dydx(oos_adopt_d) post
est store all_auth
lrtest a1 a2
lrtest a2 a3
*Sponsorship models
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol
est store b1
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum
matrix b1 = e(b)
est store b2
melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum|| statenum:, from(b1) difficult
est store b3
margins, at(oos_adopt_d=(0 1))
margins, dydx(oos_adopt_d) post
est store all_spon
lrtest b1 b2
lrtest b2 b3

*Core criminal justice policies vs. others (Main text and Table A-6)
*Authorship models
*Core policies
quietly melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & purecj==1 || _all: R.polnum
matrix c1 = e(b)
melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol  if multauth==1 & purecj==1 || _all: R.polnum|| statenum:, from(c1) difficult
*Other policies
quietly melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & purecj==0 || _all: R.polnum
matrix c2 = e(b)
melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol  if multauth==1 & purecj==0 || _all: R.polnum|| statenum:, from(c2) difficult
*Sponsorship models
*Core policies
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if purecj==1 || _all: R.polnum
matrix c3 = e(b)
melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if purecj==1 || _all: R.polnum|| statenum:, from(c3) difficult
*Other policies
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if purecj==0 || _all: R.polnum
matrix c4 = e(b)
melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if purecj==0 || _all: R.polnum|| statenum:, from(c4) difficult

*Party similarity of legislature vs. previous adopting legislator vs. sponsor (Main text)
ttest polauth if oos_adopt_d==1, by(adoptleg_same)
ttest polspon if oos_adopt_d==1, by(adoptleg_same)

*Split models by party (Main text and Table A-5, Rows 4 and 5) 
*Authorship models
*Republicans
quietly melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & party==200 || _all: R.polnum
matrix k1 = e(b)
melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & party==200 || _all: R.polnum|| statenum:, from(k1) difficult
margins, dydx(oos_adopt_d) post
est store rep_auth
*Democrats
quietly melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & party==100 || _all: R.polnum
matrix k2 = e(b)
melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & party==100 || _all: R.polnum|| statenum:, from(k2) difficult
margins, dydx(oos_adopt_d) post
est store dem_auth
*Sponsorship Models
*Republicans
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if party==200 || _all: R.polnum
matrix l1 = e(b)
melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if party==200 || _all: R.polnum|| statenum:, from(l1) difficult
margins, dydx(oos_adopt_d) post
est store rep_spon
*Democrats
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if party==100 || _all: R.polnum
matrix l2 = e(b)
melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if party==100 || _all: R.polnum|| statenum:, from(l2) difficult
margins, dydx(oos_adopt_d) post
est store dem_spon

*Figure 1
coefplot all_auth dem_auth rep_auth || all_spon dem_spon rep_spon, xline(0)
gr_edit .style.editstyle declared_ysize(2.5) editcopy
gr_edit .plotregion1.plotregion1[1]._xylines[1].style.editstyle linestyle(color(black)) editcopy
gr_edit .plotregion1.plotregion1[2]._xylines[1].style.editstyle linestyle(color(black)) editcopy
gr_edit .legend.plotregion1.key[1].view.style.editstyle marker(fillcolor(black)) editcopy
gr_edit .legend.plotregion1.key[1].view.style.editstyle marker(linestyle(color(black))) editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle marker(symbol(square)) editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle marker(fillcolor(black)) editcopy
gr_edit .legend.plotregion1.key[2].view.style.editstyle marker(linestyle(color(black))) editcopy
gr_edit .legend.plotregion1.key[3].view.style.editstyle marker(symbol(triangle)) editcopy
gr_edit .legend.plotregion1.key[3].view.style.editstyle marker(fillcolor(black)) editcopy
gr_edit .legend.plotregion1.key[3].view.style.editstyle marker(linestyle(color(black))) editcopy
gr_edit .plotregion1.plotregion1[1].plot5.style.editstyle area(linestyle(color(black))) editcopy
gr_edit .plotregion1.plotregion1[1].plot3.style.editstyle area(linestyle(color(black))) editcopy
gr_edit .plotregion1.plotregion1[1].plot1.style.editstyle area(linestyle(color(black))) editcopy
gr_edit .legend.plotregion1.label[1].text = {}
gr_edit .legend.plotregion1.label[1].text.Arrpush All Legislators
gr_edit .legend.plotregion1.label[2].text = {}
gr_edit .legend.plotregion1.label[2].text.Arrpush Democrats
gr_edit .legend.plotregion1.label[3].text = {}
gr_edit .legend.plotregion1.label[3].text.Arrpush Republicans
gr_edit .plotregion1.subtitle[1].text = {}
gr_edit .plotregion1.subtitle[1].text.Arrpush Effects on Authorship
gr_edit .plotregion1.subtitle[2].text = {}
gr_edit .plotregion1.subtitle[2].text.Arrpush Effects on Sponsorship
gr_edit .legend.Edit , style(cols(3)) style(rows(0)) keepstyles 
gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy
gr_edit .style.editstyle boxstyle(linestyle(color(white))) editcopy
gr_edit .plotregion1.subtitle[2].style.editstyle fillcolor(white) editcopy
gr_edit .plotregion1.subtitle[2].style.editstyle linestyle(color(black)) editcopy
gr_edit .plotregion1.plotregion1[2].style.editstyle boxstyle(linestyle(color(black))) editcopy
gr_edit .plotregion1.yaxis1[1].major.delete_tick 1
gr_edit .plotregion1.xaxis1[1].reset_rule -0.02 0.08 0.02 , tickset(major) ruletype(range) 
gr_edit .plotregion1.xaxis1[2].reset_rule -0.02 0.08 0.02 , tickset(major) ruletype(range) 
gr_edit .Edit , style(indiv_margin(medium))

*Appendix Analyses
 
*Descriptive statistics (Table A-3)
sum polauth if multauth==1
sum polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim sponlim termlim polcons smideol

*Models with state fixed effects (Table A-5, Row 2) 
logit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate i.statenum c.polcons##c.smideol if multauth==1, cl(polst)  
logit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate i.statenum c.polcons##c.smideol, cl(polst)

*Coarsened exact matching (Table A-5, Row 3)
cem polst(#0) chair judic majmemb blackpct smideol if match_polst==1 , treatment(oos_adopt_d)
logit polauth oos_adopt_d if multauth==1 & match_polst==1  [iw=cem_weights] , cl(polst)
logit polspon oos_adopt_d if match_polst==1 [iw=cem_weights] , cl(polst)

*Excluding the bills that weren’t passed (Table A-5, Row 6)
*Authorship model
quietly  melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & introonly==0 || _all: R.polnum
matrix e1 = e(b)
melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & introonly==0 || _all: R.polnum|| statenum:, from(e1) difficult
*Sponsorship model
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if introonly==0 || _all: R.polnum
matrix f1 = e(b)
melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if introonly==0  || _all: R.polnum|| statenum:, from(f1) difficult

*Robustness check in defining oos media markets (Table A-5, Row 7)
*Authorship model
quietly melogit polauth oos_adopt25_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 || _all: R.polnum
matrix i1 = e(b)
melogit polauth oos_adopt25_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 || _all: R.polnum|| statenum:, from(i1) difficult
*Sponsorship model
quietly melogit polspon oos_adopt25_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum
matrix j1 = e(b)
melogit polspon oos_adopt25_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum|| statenum:, from(j1) difficult

*Alternative definition of exposure district (Table A-5, Row 8)
*Authorship model
quietly melogit polauth oos_adopt_ms judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 || _all: R.polnum
matrix m1 = e(b)
melogit polauth oos_adopt_ms judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 || _all: R.polnum|| statenum:, from(m1) difficult
*Sponsorship model
quietly melogit polspon oos_adopt_ms judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum
matrix m2 = e(b)
melogit polspon oos_adopt_ms judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum|| statenum:, from(m2) difficult

*Excluding multistate districts with mixed adoptions (Table A-5, Row 9)
*Authorship model
quietly melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & multistate_adopt!=1 || _all: R.polnum
matrix g1 = e(b)
melogit polauth oos_adopt_d judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 & multistate_adopt!=1 || _all: R.polnum|| statenum:, from(g1) difficult
*Sponsorship model
quietly melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if multistate_adopt!=1 || _all: R.polnum
matrix h1 = e(b)
melogit polspon oos_adopt_d judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol if multistate_adopt!=1 || _all: R.polnum|| statenum:, from(h1) difficult

*Alternative measure of exposure districts (Table A-5, Rows 10 and 11)   
*Authorship model
quietly melogit polauth i.oos_adopt_full judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol if multauth==1 || _all: R.polnum
matrix d1 = e(b)
melogit polauth i.oos_adopt_full judic chair leader female majmemb blackpct srty senate squire introlim termlim c.polcons##c.smideol  if multauth==1 || _all: R.polnum|| statenum:, from(d1) difficult
*Sponsorship model
quietly melogit polspon i.oos_adopt_full judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum
matrix d2 = e(b)
melogit polspon i.oos_adopt_full judic chair leader female majmemb blackpct srty senate squire sponlim termlim c.polcons##c.smideol || _all: R.polnum|| statenum:, from(d2) difficult

*Table A-2 
use "C:\ENAPD State Representativeness.dta"
ttest pci, by(enapd)
ttest obama, by(enapd)
ttest blackpct, by(enapd)
ttest hisppct, by(enapd)
ttest squire, by(enapd)
ttest legsize_tot, by(enapd)
ttest innov, by(enapd)
ttest termlim, by(enapd)

